package com.zhongbei.service.impl;

import com.zhongbei.mapper.UserMapper;
import com.zhongbei.pojo.User;
import com.zhongbei.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;



    @Override
    public int insertOne(User user) {
        int i = userMapper.insertOne(user);
        return i;
    }

    @Override
    public int deleteUserById(Integer id) {
        int i = userMapper.deleteUserById(id);
        return i;
    }

    @Override
    public int updateById(User user) {
         int i = userMapper.updateById(user);
        return i;
    }
    @Override
    public List<User> getAllUser(){
        //正真的业务逻辑
        List<User> allUser = userMapper.getAllUser();
        return allUser;
    }

    @Override
    public User userByName(String name) {
        User user  = userMapper.userByName(name);
        return user;
    }


    @Override
    public int isLogin(User user){
        int count = userMapper.isLogin(user);
        return count;
    }

}
